﻿using System;
using System.Reflection;
using StreetPacMan.Server.Infra;

namespace StreetPacMan.FrontEnd
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            Bootstrapper.Bootstrap(Assembly.GetExecutingAssembly());

            //InjectMocks();
        }

        //private void InjectMocks()
        //{
        //    var mockParametersConverter = MockRepository.GenerateStub<IServerPollParametersConverter>();
        //    mockParametersConverter.Stub(x => x.GetServerPollParametersFromRequest(null)).IgnoreArguments().Return(
        //        new ServerPollParameters(0, 0, 0, true));
        //    //mockParametersConverter.Stub(x => x.GetNewGameParametersFromRequest(null)).IgnoreArguments().Return(
        //    //    new GetNewGameParameters("ABC"));


        //    StructureMap.ObjectFactory.Inject(mockParametersConverter);

        //    var mockServerFacade = MockRepository.GenerateStub<IServerFacade>();
        //    mockServerFacade.Stub(x => x.UpdateMyWhereabouts(null)).IgnoreArguments().Return(
        //        new ServerPollResult(new[] { new ClientEntity(3546, PlayerRole.Observer, 0, 0) }, "If you need real results - comment out the InjectMocks method call in the Global.asax Application_Start method",
        //                             new[] {4, 5, 6}));
        //    mockServerFacade.Stub(x => x.GetGameStateWithApples(null)).IgnoreArguments().Return(
        //        new GetGameStateResult(
        //            GamesStorage._InitialApples.Select(x => new ClientEntity(3546, PlayerRole.Apple, x.Lat, x.Lon)).ToArray()));

        //    StructureMap.ObjectFactory.Inject(mockServerFacade);
        //}

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {

        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}
